<?php

namespace app\sisome\controller;

use think\Controller;
use fast\Tree;


class Rule extends Common
{	

	public function _initialize()
    {
		parent::_initialize();
		$this->model = db('aduser');

		// 必须将结果集转换为数组
		$ruleList = collection(db('rule')->order('id', 'asc')->select());
		// foreach ($ruleList as $k => &$v) {
		// 	$v['title'] = __($v['title']);
		// 	$v['remark'] = __($v['remark']);
		// }
		unset($v);
		Tree::instance()->init($ruleList);
		$this->rulelist = Tree::instance()->getTreeList(Tree::instance()->getTreeArray(0), 'title');
		// $ruledata = [0 => __('None')];
		foreach ($this->rulelist as $k => &$v) {
			$ruledata[$v['id']] = $v['title'];
			$ruledata[$v['id']] = $v['title'];
		}
		unset($v);

		$this->view->assign('ruledata', $ruledata);

	}


	//菜单管理
	public function index()
	{			
		
		// $list = db('rule')->order('ID DESC')->paginate(20);
		// $this->assign('lists', $list); // 賦值數據集
		return view();
	}
	
}
